/*
 * @Author: liu-tiezhu1 1471528799@qq.com
 * @Date: 2023-11-25 10:12:02
 * @LastEditors: liu-tiezhu1 1471528799@qq.com
 * @LastEditTime: 2023-11-25 10:45:10
 * @FilePath: \customer-relations\src\utils\Tools\query.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
export const objToQueryString = (obj: object) => {
    let ret = ''
    for (let key in obj) {
        ret += `&${key}=${(obj as any)[key]}`
    }
    return ret
}



//判断是否为空对象
export const isEmptyObj = (obj: object) => {
    return Object.keys(obj).length === 0 ? true : false
  }
  

  // 返回非空的对象属性
export const noEmptySearchObject = <T extends object>(obj: T) => {
    // let ret = {}
    let ret = {} as T
    for (let key in obj) {
      // 它当前有值
      if (obj[key]) {
        // (ret as any)[key] = obj[key]
        ret[key] = obj[key]
      }
    }
    return isEmptyObj(ret) ? null : ret
  }